<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图书借阅管理系统</title>
    <link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" rel="stylesheet">
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script src="https://unpkg.com/element-plus"></script>
    <style>
        body {
            margin: 0;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        .el-container {
            height: 100vh;
        }

        .el-header,
        .el-aside {
            background-color: #344a5f;
            color: white;
        }

        .el-header {
            display: flex;
            align-items: center;
            padding: 0 20px;
            height: 70px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            justify-content: center;
        }

        .el-header h1 {
            margin: 0 auto;
        }

        .el-aside {
            width: 200px;
            display: flex;
            flex-direction: column;
            transition: width 0.3s ease;
        }

        .el-aside.collapsed {
            width: 64px;
        }

        .el-main,
        .el-footer {
            background-color: #e9ecef;
        }

        .el-main {
            padding: 20px;
        }

        .avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin: 0 10px;
            vertical-align: middle;
            cursor: pointer;
        }

        .sidebar-header {
            padding: 20px;
            text-align: center;
        }

        .sidebar-header img {
            width: 60px;
            height: 60px;
        }

        .el-menu {
            flex: 1;
            border-right: none;
        }

        .el-footer {
            text-align: center;
            padding: 10px;
        }

        .header-right {
            display: flex;
            align-items: center;
        }

        .role {
            margin-right: 10px;
        }

        .username {
            margin-right: 10px;
            cursor: pointer;
        }

        .search-area {
            margin-top: 20px;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
        }

        .search-input {
            width: 200px;
            margin-right: 10px;
            margin-bottom: 10px;
        }

        .button-area {
            margin-bottom: 20px;
        }

        .separator {
            margin: 0 10px;
            color: white;
        }
    </style>
</head>

<body>
<div id="app">
    <el-container>
        <el-aside :class="{ collapsed: sidebarCollapsed }">
            <div class="sidebar-header">
                <img src="https://picsum.photos/60/60" alt="Library Icon">
            </div>
            <el-menu
                    default-active="1"
                    class="el-menu-vertical-demo"
                    :collapse="sidebarCollapsed"
                    background-color="#344a5f"
                    text-color="#fff"
                    active-text-color="#ffd04b">
                <el-sub-menu index="1">
                    <template #title>
                        <i class="fa-solid fa-book-open"></i>
                        <span>图书管理</span>
                    </template>
                    <el-menu-item index="1-1">
                        <i class="fa-solid fa-list"></i>
                        <span>图书列表</span>
                    </el-menu-item>
                    <el-menu-item index="1-2">
                        <i class="fa-solid fa-folder-open"></i>
                        <span>图书分类</span>
                    </el-menu-item>
                    <el-menu-item index="1-3">
                        <i class="fa-solid fa-copy"></i>
                        <span>图书副本管理</span>
                    </el-menu-item>
                </el-sub-menu>
                <el-sub-menu index="2">
                    <template #title>
                        <i class="fa-solid fa-users"></i>
                        <span>读者管理</span>
                    </template>
                    <el-menu-item index="2-1">
                        <i class="fa-solid fa-user"></i>
                        <span>读者列表</span>
                    </el-menu-item>
                    <el-menu-item index="2-2">
                        <i class="fa-solid fa-building"></i>
                        <span>部门列表</span>
                    </el-menu-item>
                </el-sub-menu>
                <el-sub-menu index="3">
                    <template #title>
                        <i class="fa-solid fa-exchange"></i>
                        <span>借阅管理</span>
                    </template>
                    <el-menu-item index="3-1">
                        <i class="fa-solid fa-file-check"></i>
                        <span>借阅记录</span>
                    </el-menu-item>
                    <el-menu-item index="3-2">
                        <i class="fa-solid fa-sync"></i>
                        <span>续借管理</span>
                    </el-menu-item>
                    <el-menu-item index="3-3">
                        <i class="fa-solid fa-clock"></i>
                        <span>预约管理</span>
                    </el-menu-item>
                    <el-menu-item index="3-4">
                        <i class="fa-solid fa-exclamation-triangle"></i>
                        <span>逾期管理</span>
                    </el-menu-item>
                </el-sub-menu>
                <el-sub-menu index="4">
                    <template #title>
                        <i class="fa-solid fa-cog"></i>
                        <span>系统管理</span>
                    </template>
                    <el-menu-item index="4-1">
                        <i class="fa-solid fa-file-search"></i>
                        <span>操作日志</span>
                    </el-menu-item>
                </el-sub-menu>
                <el-sub-menu index="5">
                    <template #title>
                        <i class="fa-solid fa-user-circle"></i>
                        <span>用户中心</span>
                    </template>
                    <el-menu-item index="5-1">
                        <i class="fa-solid fa-key"></i>
                        <span>修改密码</span>
                    </el-menu-item>
                </el-sub-menu>
            </el-menu>
        </el-aside>
        <el-container>
            <el-header>
                <el-button @click="sidebarCollapsed = !sidebarCollapsed" style="color: white;">
                    <i class="fa-solid fa-angle-double-left" :class="sidebarCollapsed? 'fa-rotate-180' : ''"></i>
                </el-button>
                <h1>图书借阅管理系统</h1>
                <div class="header-right" style="margin-left: auto;">
                    <span class="role">管理员</span>
                    <span class="separator">|</span>
                    <div @click="showUserMenu = !showUserMenu">
                        <img class="avatar" src="https://picsum.photos/40/40" alt="Avatar">
                        <span class="username">用户名</span>
                    </div>
                    <span class="separator">|</span>
                    <el-dropdown v-model="showUserMenu">
                        <template #dropdown>
                            <el-dropdown-menu>
                                <el-dropdown-item @click="goToUserCenter">用户中心</el-dropdown-item>
                                <el-dropdown-item @click="changePassword">修改密码</el-dropdown-item>
                                <el-dropdown-item @click="logout">注销</el-dropdown-item>
                            </el-dropdown-menu>
                        </template>
                    </el-dropdown>
                </div>
            </el-header>
            <el-main>
                <el-breadcrumb separator="/">
                    <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                    <el-breadcrumb-item>当前页面</el-breadcrumb-item>
                </el-breadcrumb>
                <div class="search-area">
                    <el-input
                            v-model="bookName"
                            placeholder="图书名"
                            class="search-input">
                    </el-input>
                    <el-input
                            v-model="priceRange"
                            placeholder="价格范围"
                            class="search-input">
                    </el-input>
                    <el-input
                            v-model="author"
                            placeholder="作者"
                            class="search-input">
                    </el-input>
                    <el-input
                            v-model="publisher"
                            placeholder="出版社"
                            class="search-input">
                    </el-input>
                    <el-select v-model="category" placeholder="类别" class="search-input">
                        <el-option label="文学作品" value="文学作品"></el-option>
                        <el-option label="侦探推理" value="侦探推理"></el-option>
                        <el-option label="科幻小说" value="科幻小说"></el-option>
                        <el-option label="历史传记" value="历史传记"></el-option>
                    </el-select>
                    <el-button @click="search">
                        <i class="fa-solid fa-magnifying-glass"></i>
                    </el-button>
                    <el-button @click="resetSearch">
                        <i class="fa-solid fa-rotate-right"></i> 重置
                    </el-button>
                </div>
                <div class="button-area">
                    <el-button type="primary">
                        <i class="fa-solid fa-plus"></i> 新增
                    </el-button>
                    <el-button type="danger">
                        <i class="fa-solid fa-trash"></i> 删除
                    </el-button>
                    <el-button type="success">
                        <i class="fa-solid fa-upload"></i> 上架
                    </el-button>
                </div>
                <el-table :data="tableData" stripe>
                    <el-table-column prop="id" label="ID"></el-table-column>
                    <el-table-column prop="name" label="图书名"></el-table-column>
                    <el-table-column prop="price" label="价格"></el-table-column>
                    <el-table-column prop="author" label="作者"></el-table-column>
                    <el-table-column prop="publisher" label="出版社"></el-table-column>
                    <el-table-column prop="category" label="类别"></el-table-column>
                    <el-table-column label="操作">
                        <template #default="scope">
                            <el-button type="primary" size="small">
                                <i class="fa-solid fa-pen-to-square"></i> 编辑
                            </el-button>
                            <el-button type="danger" size="small">
                                <i class="fa-solid fa-trash"></i> 删除
                            </el-button>
                            <el-dropdown>
                                <el-button type="text" size="small">
                                    更多 <i class="fa-solid fa-caret-down"></i>
                                </el-button>
                                <template #dropdown>
                                    <el-dropdown-menu>
                                        <el-dropdown-item @click="otherOperation1(scope.row)">操作1</el-dropdown-item>
                                        <el-dropdown-item @click="otherOperation2(scope.row)">操作2</el-dropdown-item>
                                    </el-dropdown-menu>
                                </template>
                            </el-dropdown>
                        </template>
                    </el-table-column>
                </el-table>
            </el-main>
            <el-footer>版权所有 &copy; 图书借阅管理系统 2024</el-footer>
        </el-container>
    </el-container>
</div>
<script>
    const { createApp } = Vue;
    const app = createApp({
        data() {
            return {
                sidebarCollapsed: false,
                bookName: '',
                priceRange: '',
                author: '',
                publisher: '',
                category: '',
                tableData: [
                    { id: 1, name: '图书1', price: '20.00', author: '作者1', publisher: '出版社1', category: '文学作品' },
                    { id: 2, name: '图书2', price: '30.00', author: '作者2', publisher: '出版社2', category: '侦探推理' },
                    { id: 3, name: '图书3', price: '25.00', author: '作者3', publisher: '出版社3', category: '科幻小说' }
                ],
                showUserMenu: false
            };
        },
        methods: {
            logout() {
                alert('已注销');
            },
            search() {
                console.log('搜索条件 - 图书名：', this.bookName);
                console.log('搜索条件 - 价格范围：', this.priceRange);
                console.log('搜索条件 - 作者：', this.author);
                console.log('搜索条件 - 出版社：', this.publisher);
                console.log('搜索条件 - 类别：', this.category);
            },
            goToUserCenter() {
                console.log('前往用户中心');
            },
            changePassword() {
                console.log('修改密码');
            },
            resetSearch() {
                this.bookName = '';
                this.priceRange = '';
                this.author = '';
                this.publisher = '';
                this.category = '';
            },
            otherOperation1(row) {
                console.log('对行数据执行操作1', row);
            },
            otherOperation2(row) {
                console.log('对行数据执行操作2', row);
            }
        }
    });
    app.use(ElementPlus);
    app.mount('#app');
</script>
</body>

</html>
